Skip to content

Potential fix for code scanning alert no. 6: Workflow does not contain permissions#37

Merged
albertomandlate merged 1 commit intomainfrom
alert-autofix-6
May 22, 2025
Merged

Potential fix for code scanning alert no. 6: Workflow does not contain permissions#37
albertomandlate merged 1 commit intomainfrom
alert-autofix-6

Conversation

@albertomandlate
Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/SimansoftMZ/SAF-T/security/code-scanning/6

To fix the issue, we will add a permissions block at the root of the workflow to define the minimal permissions required for the workflow. Most steps in the workflow only require contents: read, but the step that publishes to NuGet requires packages: write. We will set contents: read at the root level and override it with packages: write for the specific job that publishes to NuGet.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@albertomandlate albertomandlate marked this pull request as ready for review May 22, 2025 16:34
Copilot AI review requested due to automatic review settings May 22, 2025 16:34
@albertomandlate albertomandlate merged commit 830a336 into main May 22, 2025
2 of 3 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds minimal permissions to the GitHub Actions workflow to address the code scanning alert regarding missing permissions.

  • Introduces a root-level permissions block granting contents: read by default.
  • Overrides permissions in the NuGet publishing step to packages: write.

Comment on lines +61 to +62
permissions:
packages: write
Copy link

Copilot AI May 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The permissions block is defined under a step, but GitHub Actions only supports permissions at the workflow or job level. Move this packages: write override to the job definition for the NuGet publishing job.

Suggested change
permissions:
packages: write

Copilot uses AI. Check for mistakes.
@albertomandlate albertomandlate deleted the alert-autofix-6 branch May 22, 2025 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants